
Ext.define('ModeloLideresF', {
    extend: 'Ext.data.Model',
    fields: [{
        name: 'id',
        type: 'int',
    },{
        name: 'nroDocumento',
        type: 'int',
    },{
        name: 'telefono',
        type: 'int',
    },{
        name: 'fasePosicion',
        type: 'int',
    }, 'email', 'nombre', 'apellido', 'nombreUsuario', 'faseNombre','fasePosicion']
});


Ext.define('proyectos.LideresFGrid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.LideresFGrid',

    requires: [
        'Ext.form.field.Text',
        'Ext.toolbar.TextItem'
    ],

    initComponent: function(){

        Ext.apply(this, {
            iconCls: 'icon-grid',
            dockedItems: [{ 
                weight: 1,
                xtype: 'toolbar',
                dock: 'bottom',
                items: ['->', {
                    iconCls: 'icon-refresh',
                    text: '<b>Actualizar</b>',
                    scope: this,
                    handler: this.onRefresh
                },{
                    iconCls: 'icon-salir',
                    text: '<b>Salir</b>',
                    scope: this,
                    handler: this.onSalir
                }]
            }],
            columns: [{
                text: 'Id',
                width: 40,
                hidden: true,
                dataIndex: 'id'
            },{
                header: '<b>Usuario</b>',
                flex: 1,
                dataIndex: 'nombreUsuario',

            },{
                header: '<b>Nombre</b>',
                flex: 1,
                dataIndex: 'nombre',

            }, {
                header: '<b>Apellido</b>',
                flex: 1,
                dataIndex: 'apellido',

            },{
                text: '<b>Telefono</b>',
                width: 70,
                dataIndex: 'telefono'
            }, {
                header: '<b>Email</b>',
                width: 150,
                dataIndex: 'email',

            }, {
                header: '<b>Nombre Fase</b>',
                flex: 1,
                dataIndex: 'faseNombre',

            },{
                header: '<b>Posicion Fase</b>',
                flex: 1,
                dataIndex: 'fasePosicion',

            }]
        });
        this.callParent();
        this.getSelectionModel().on('selectionchange', this.onSelectChange, this);
    },
    
	onSalir: function(){		 
		this.fireEvent('salir');
	},

    onRefresh: function(){
		this.getSelectionModel().clearSelections();
		this.store.load();
    }
});
